//
//  UIImageView+PYWebImage.m
//  catuncel
//
//  Created by Jim on 2018/1/12.
//  Copyright © 2018年 Jim. All rights reserved.
//

#import "UIImageView+PYWebImage.h"

@implementation UIImageView (PYWebImage)

- (void)py_setImageWithURL:(NSURL *_Nullable)url
{
    __weak typeof(self) weakSelf = self;
    
    [self sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"750_750"] options:SDWebImageLowPriority | SDWebImageRetryFailed | SDWebImageScaleDownLargeImages completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
        
        if (image) {
            
            weakSelf.image = [image normalizedImage];
        }
    }];
}

- (void)py_setImageWithURL:(NSURL *_Nullable)url completed:(PYExternalCompletionBlock _Nullable)completion
{
    [self sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"750_750"] options:SDWebImageLowPriority | SDWebImageRetryFailed | SDWebImageScaleDownLargeImages completed:completion];
}

@end
